package com.java.dp.factory;

import java.util.HashMap;
import java.util.Map;

/**
 * @Author lizhilong
 * @create 2019/12/2 17:34
 * @desc
 */
public class FactoryMain {

    private  static Map beanMap = new HashMap();
    static {
        try {
           beanMap.put("food",Class.forName("com.java.dp.factory.FoodFactory").newInstance());
           beanMap.put("clothse",Class.forName("com.java.dp.factory.ClothesFactory").newInstance());
        }catch (Exception e){
            e.printStackTrace();
        }
    }
    public static void main(String[] args) {
         Factory foodFactory  = (FoodFactory) beanMap.get("food");
         foodFactory.defineBuildLine().build();

         Factory clothseFactory = (Factory) beanMap.get("clothse");
         clothseFactory.defineBuildLine().build();
    }
}
